<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0 auto;
            padding: 0;
        }
        body {
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        /* .box div span {
            position: fixed;
            top: 45%;
            left: 45%;          
        } */
        #slider {
            width: 90vw;
            max-width: 500px;
            cursor: pointer;
        }
       
    </style>
</head>
<body>
    <div class="box">
        <div class="sp">分数：<span>20</span></div>
            <input type="range" id="slider" value="20">
        </div>
        <script>
            const input = document.querySelector('#slider')
            const span = document.querySelector('.sp span')
            input.addEventListener('click',function() {
                span.innerHTML = input.value
            })
        </script>
</body>
</html>